
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;

import javax.swing.*;

public class BoardFrame extends JFrame implements WindowListener, MouseListener
{

	static ImageIcon boardImage = new ImageIcon("images/board.png");

	JLabel board;
	JLabel firstPlayer;
	JLabel secondPlayer;

	public BoardFrame()
	{
		super("Nine Men's Morris");
		board = new JLabel(boardImage);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setContentPane(board);
		setBounds(180,70,510,530);
		addWindowListener(this);
		board.addMouseListener(this);

		firstPlayer = new JLabel();
		firstPlayer.setBounds(200, 215, 200, 50);
		add(firstPlayer);

		secondPlayer = new JLabel();
		secondPlayer.setBounds(200, 250, 200, 50);
		add(secondPlayer);
	}

	void setStatus(playersInfoEntry x)
	{
		firstPlayer.setText(x.firstPlayerName.getText());
		secondPlayer.setText(x.secondPlayerName.getText());

		firstPlayer.setForeground(x.firstColor);
		secondPlayer.setForeground(x.secondColor);
	}

	void setStatus(singlePlayerInfoEntry x)
	{
		
	}

	public void windowActivated(WindowEvent e)
	{
	}

	public void windowClosed(WindowEvent e)
	{
		setVisible(false);
	}

	public void windowClosing(WindowEvent e)
	{
	}

	public void windowDeactivated(WindowEvent e)
	{
	}

	public void windowDeiconified(WindowEvent e)
	{
	}

	public void windowIconified(WindowEvent e)
	{
	}

	public void windowOpened(WindowEvent e)
	{
	}

	public void mouseClicked(MouseEvent e)
	{
	}

	public void mouseEntered(MouseEvent e)
	{
	}

	public void mouseExited(MouseEvent e)
	{
	}

	public void mousePressed(MouseEvent e)
	{
	}

	public void mouseReleased(MouseEvent e)
	{
		System.out.println(e.getX());
		Graphics2D g2 = (Graphics2D) getGraphics();
		g2.drawRoundRect(getX(), getY(), 20, 20, 100, 20);
		g2.draw(new Ellipse2D.Double(e.getX(), e.getY(), 20, 20));
		g2.setColor(new Color(50,60,70));
		g2.setBackground(new Color(60,70,80));
//		g2.fillOval(e.getX()+e.translatePoint(e.getX(), e.getY()), e.getY(), 40, 40);
	}
}

//java.awt.Point[x=363,y=243]
//java.awt.Point[x=376,y=243]
//java.awt.Point[x=363,y=261]
//java.awt.Point[x=375,y=261]